package cn.com.visionsky.bocsz.bda.webservice.permission;

import cn.com.visionsky.bocsz.bda.webservice.Constants;
import cn.com.visionsky.bocsz.bda.webservice.handler.customer_tags_query.FullTextRequest;
import cn.com.visionsky.bocsz.bda.webservice.ws.FullTextUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhouqiufu on 2018/1/30.
 * 用于识别和记录被请求的字段
 */
public class RequestedCustomerTags {
    private static final Logger logger = LoggerFactory.getLogger(RequestedCustomerTags.class);

    private FullTextRequest fullTextRequest;

    public RequestedCustomerTags(FullTextRequest fullTextRequest){
        this.fullTextRequest = fullTextRequest;
    }

    public List<String> discernRequestedField(){//识别被请求的字段

        String etlDate = fullTextRequest.getEtlDate();
        String ctfNo = fullTextRequest.getCtfNo();
        String cstNm = fullTextRequest.getCstNm();
        String sex = fullTextRequest.getSex();
        String birthday = fullTextRequest.getBirthday();
        String age = fullTextRequest.getAge();
        String acNoGjj = fullTextRequest.getAcNoGjj();
        String preSalary = fullTextRequest.getPreSalary();
        String isBocStaff = fullTextRequest.getIsBocStaff();
        String lvlKyc = fullTextRequest.getLvlKyc() ;
        String mobphnNo = fullTextRequest.getMobphnNo();
        String telCheck = fullTextRequest.getTelCheck();
        String occuCode = fullTextRequest.getOccuCode();
        String isGat = fullTextRequest.getIsGat();
        String nationality = fullTextRequest.getNationality();
        String nation = fullTextRequest.getNation();
        String homeAdr = fullTextRequest.getHomeAdr();
        String unitAdr = fullTextRequest.getUnitAdr();
        String email = fullTextRequest.getEmail();
        String maritalStatus = fullTextRequest.getMaritalStatus();
        String educationCode = fullTextRequest.getEducationCode();
        String unitNm = fullTextRequest.getUnitNm();
        String isMgr = fullTextRequest.getIsMgr();
        String groupCode = fullTextRequest.getGroupCode();
        String cstId = fullTextRequest.getCstId();
        //String mode = fullTextRequest.getMode();//选择模式（1.根据客户号查询 2.根据客户证件号查询）该字段不必进行识别

        List<String> requestedFieldList = new ArrayList<String>();
        
        if(StringUtils.isNotBlank(etlDate)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_ETL_DATE);
        }
        /*
        if(StringUtils.isNotBlank(ctfNo)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_CTF_NO);
        }
        */
        if(StringUtils.isNotBlank(cstNm)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_CST_NM);
        }
        if(StringUtils.isNotBlank(sex)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_SEX);
        }
        if(StringUtils.isNotBlank(birthday)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_BIRTHDAY);
        }
        if(StringUtils.isNotBlank(age)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_AGE);
        }
        if(StringUtils.isNotBlank(acNoGjj)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_AC_NO_GJJ);
        }
        if(StringUtils.isNotBlank(preSalary)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_PRE_SALARY);
        }
        if(StringUtils.isNotBlank(isBocStaff)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_IS_BOC_STAFF);
        }
        if(StringUtils.isNotBlank(lvlKyc)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_LVL_KYC);
        }
        if(StringUtils.isNotBlank(mobphnNo)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_MOBPHN_NO);
        }
        if(StringUtils.isNotBlank(telCheck)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_TEL_CHECK);
        }
        if(StringUtils.isNotBlank(occuCode)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_OCCU_CODE);
        }
        if(StringUtils.isNotBlank(isGat)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_IS_GAT);
        }
        if(StringUtils.isNotBlank(nationality)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_NATIONALITY);
        }
        if(StringUtils.isNotBlank(nation)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_NATION);
        }
        if(StringUtils.isNotBlank(homeAdr)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_HOME_ADR);
        }
        if(StringUtils.isNotBlank(unitAdr)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_UNIT_ADR);
        }
        if(StringUtils.isNotBlank(email)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_EMAIL);
        }
        if(StringUtils.isNotBlank(maritalStatus)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_MARITAL_STATUS);
        }
        if(StringUtils.isNotBlank(educationCode)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_EDUCATION_CODE);
        }
        if(StringUtils.isNotBlank(unitNm)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_UNIT_NM);
        }
        if(StringUtils.isNotBlank(isMgr)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_IS_MGR);
        }
        if(StringUtils.isNotBlank(groupCode)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_GROUP_CODE);
        }
        /*
        if(StringUtils.isNotBlank(cstId)){
            requestedFieldList.add(Constants.CUSTOMER_TAGS_QUERY_MOUDLE_CST_ID);
        }
        */
            
       return requestedFieldList;
    }

}
